<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Apple devices fullscreen -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Apple devices fullscreen -->
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" media="screen"/>
<link href="/public/plugins/layui/css/layui.css?v=v1.6.3" rel="stylesheet" type="text/css">
<link href="/public/static/admin/css/main.css?v=v1.6.3" rel="stylesheet" type="text/css">
<link href="/public/static/admin/css/page.css?v=v1.6.3" rel="stylesheet" type="text/css">
<link href="/public/static/admin/font/css/font-awesome.min.css?v=v1.6.3" rel="stylesheet" />
<link href="/public/static/admin/font/css/iconfont.css?v=v1.6.3" rel="stylesheet" />
<!--[if IE 7]>
  <link rel="stylesheet" href="/public/static/admin/font/css/font-awesome-ie7.min.css?v=v1.6.3">
<![endif]-->
<script type="text/javascript">
    var eyou_basefile = "/login.php";
    var module_name = "admin";
    var GetUploadify_url = "/uploads.html";
    // 插件专用旧版上传图片框
    if ('Weapp@execute' == "Admin@admin_edit") {
      GetUploadify_url = "/uploads.html";
    }
    var __root_dir__ = "";
    var __lang__ = "cn";
    var __seo_pseudo__ = 1;
    var __web_xss_filter__ = 0;
    var __is_mobile__ = 0;
    var __security_ask_open__ = 0;
</script>  
<link href="/public/static/admin/js/jquery-ui/jquery-ui.min.css?v=v1.6.3" rel="stylesheet" type="text/css"/>
<link href="/public/static/admin/js/perfect-scrollbar.min.css?v=v1.6.3" rel="stylesheet" type="text/css"/>
<!-- <link type="text/css" rel="stylesheet" href="/public/plugins/tags_input/css/jquery.tagsinput.css?v=v1.6.3"> -->
<style type="text/css">html, body { overflow: visible;}</style>
<link href="/public/static/admin/css/diy_style.css?v=v1.6.3" rel="stylesheet" type="text/css" />

<!-- 官方内置样式表，升级会覆盖变动，请勿修改，否则后果自负 -->

<style type="text/css">
	/*左侧收缩图标*/
	#foldSidebar i { font-size: 24px;color:#3398cc; }
    /*左侧菜单*/
    .eycms_cont_left{ background:#3398cc; }
    .eycms_cont_left dl dd a:hover,.eycms_cont_left dl dd a.on,.eycms_cont_left dl dt.on{ background:#2189be; }
    .eycms_cont_left dl dd a:active{ background:#2189be; }
    .eycms_cont_left dl.jslist dd{ background:#3398cc; }
    .eycms_cont_left dl.jslist dd a:hover,.eycms_cont_left dl.jslist dd a.on{ background:#2189be; }
    .eycms_cont_left dl.jslist:hover{ background:#2189be; }
    /*栏目操作*/
    .cate-dropup .cate-dropup-con a:hover{ background-color: #3398cc; }
    /*按钮*/
    a.ncap-btn-green { background-color: #3398cc; }
    a:hover.ncap-btn-green { background-color: #2189be; }
    .flexigrid .sDiv2 .btn:hover { background-color: #3398cc; }
    .flexigrid .mDiv .fbutton div.add{background-color: #3398cc; border: none;}
    .flexigrid .mDiv .fbutton div.add:hover{ background-color: #2189be;}
	.flexigrid .mDiv .fbutton div.adds{color:#3398cc;border: 1px solid #3398cc;}
	.flexigrid .mDiv .fbutton div.adds:hover{ background-color: #3398cc;}
    /*选项卡字体*/
    .tab-base a.current,
    .tab-base a:hover.current {color:#3398cc !important;}
    .tab-base a.current:after,
    .tab-base a:hover.current:after {background-color: #3398cc;}
    .addartbtn input.btn:hover{ border-bottom: 1px solid #3398cc; }
    .addartbtn input.btn.selected{ color: #3398cc;border-bottom: 1px solid #3398cc;}
	/*会员导航*/
	.member-nav-group .member-nav-item .btn.selected{background: #3398cc;border: 1px solid #3398cc;box-shadow: -1px 0 0 0 #3398cc;}
	.member-nav-group .member-nav-item:first-child .btn.selected{border-left: 1px solid #3398cc !important;}
	/*搜索按钮图标*/
	.flexigrid .sDiv2 .fa-search{}
        
    /* 商品订单列表标题 */
   .flexigrid .mDiv .ftitle h3 {border-left: 3px solid #3398cc;} 
	
    /*分页*/
    .pagination > .active > a, .pagination > .active > a:focus, 
	.pagination > .active > a:hover, 
	.pagination > .active > span, 
	.pagination > .active > span:focus, 
	.pagination > .active > span:hover { border-color: #3398cc;color:#3398cc; }
    
    .layui-form-onswitch {border-color: #3398cc !important;background-color: #3398cc !important;}
    .onoff .cb-enable.selected { background-color: #3398cc !important;border-color: #3398cc !important;}
    .onoff .cb-disable.selected {background-color: #3398cc !important;border-color: #3398cc !important;}
    .pcwap-onoff .cb-enable.selected { background-color: #3398cc !important;border-color: #3398cc !important;}
    .pcwap-onoff .cb-disable.selected {background-color: #3398cc !important;border-color: #3398cc !important;}
    input[type="text"]:focus,
    input[type="text"]:hover,
    input[type="text"]:active,
    input[type="password"]:focus,
    input[type="password"]:hover,
    input[type="password"]:active,
    textarea:hover,
    textarea:focus,
    textarea:active { border-color:rgba(51,152,204,0.8);box-shadow: 0 0 0 1px rgba(51,152,204,0.5) !important;}
    .input-file-show:hover .type-file-button {background-color:#3398cc !important; }
    .input-file-show:hover {border-color: #3398cc !important;box-shadow: 0 0 5px rgba(51,152,204,0.5) !important;}
    .input-file-show:hover span.show a,
    .input-file-show span.show a:hover { color: #3398cc !important;}
    .input-file-show:hover .type-file-button {background-color: #3398cc !important; }
    .color_z { color: #3398cc !important;}
    a.imgupload{
        background-color: #3398cc !important;
        border-color: #3398cc !important;
    }
    /*专题节点按钮*/
    .ncap-form-default .special-add{background-color:#3398cc;border-color:#3398cc;}
    .ncap-form-default .special-add:hover{background-color:#2189be;border-color:#2189be;}
    
    /*更多功能标题*/
    .on-off_panel .title::before {background-color:#3398cc;}
    .on-off_panel .on-off_list-caidan .icon_bg .on{color: #3398cc;}
    .on-off_panel .e-jianhao {color: #3398cc;}
    
     /*内容菜单*/
    .ztree li a:hover{color:#3398cc !important;}
    .ztree li a.curSelectedNode{background-color: #3398cc !important; border-color:#3398cc !important;}
    .layout-left .on-off-btn {background-color: #3398cc !important;}

    .iframe_loading{
        width:100%;
        background:url(/public/static/admin/images/loading-0.gif) no-repeat center center;
    }
    
    .layui-btn-normal {background-color: #3398cc;}
    
    /* 商品规格按钮 */
    /* .preset-bt{border-color: #3398cc !important;background:#3398cc;} */
</style>
<script type="text/javascript" src="/public/static/admin/js/jquery.js?v=v1.6.3"></script>
<!-- <script type="text/javascript" src="/public/plugins/tags_input/js/jquery.tagsinput.js?v=v1.6.3"></script> -->
<script type="text/javascript" src="/public/static/admin/js/jquery-ui/jquery-ui.min.js?v=v1.6.3"></script>
<script type="text/javascript" src="/public/plugins/layer-v3.1.0/layer.js?v=v1.6.3"></script>
<script type="text/javascript" src="/public/static/admin/js/jquery.cookie.js?v=v1.6.3"></script>
<script type="text/javascript" src="/public/static/admin/js/admin.js?v=v1.6.3"></script>
<script type="text/javascript" src="/public/static/admin/js/jquery.validation.min.js?v=v1.6.3"></script>
<script type="text/javascript" src="/public/static/admin/js/common.js?v=v1.6.3"></script>
<script type="text/javascript" src="/public/static/admin/js/perfect-scrollbar.min.js?v=v1.6.3"></script>
<script type="text/javascript" src="/public/static/admin/js/jquery.mousewheel.js?v=v1.6.3"></script>
<script type="text/javascript" src="/public/plugins/layui/layui.js?v=v1.6.3"></script>
<script src="/public/static/admin/js/myFormValidate.js?v=v1.6.3"></script>
<script src="/public/static/admin/js/myAjax2.js?v=v1.6.3"></script>
<script src="/public/static/admin/js/global.js?v=v1.6.3"></script>

<link href="css/index.css" rel="stylesheet" type="text/css" />
    <script src="js/vue.min.js"></script>
    <script src="js/vue-resource.min.js"></script>
    <script src="js/index.js"></script>

</head>
<body class="rolecss bodystyle">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page" id="app">
        <div class="fixed-bar">
        <div class="item-title">
            <a class="back_xin" href="/" title="返回"><i class="iconfont e-fanhui"></i></a>
            <div class="subject">
                <h3>个人信息</h3>
                <h5></h5>
            </div>
        </div>
    </div>
        <form class="form-horizontal" id="postForm" action="" method="post">
        <input type="hidden" name="admin_id" v-model="admin_id" :value="list.admin_id">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label for="head_pic">用户头像</label>
                </dt>
                <dd class="opt">
                    <div class="txpic" onClick="GetUploadify(1,'','allimg','head_pic_call_back');">
                        <input type="hidden" name="head_pic" id="head_pic" value="" />
                        <img id="img_head_pic" src="/public/static/common/images/dfboy.png" />
                        <em>更换头像</em>
                    </div>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="username">用&nbsp;&nbsp;户&nbsp;&nbsp;名</label>
                </dt>
                <dd class="opt">
                                            <input type="text" name="user_name" :value="list.user_name" v-model="user_name" class="input-txt" :placeholder="list.user_name" autocomplete="off">
                        <p class="notic">为了安全起见，请勿设置网络常见的用户名，且不能与笔名一致，以免被暴露在网站前台</p>
                                    </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="password">用户密码</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="password"  id="password" v-model="password" autocomplete="off" class="input-txt" placeholder="不修改留空">
                    <p class="notic">密码长度至少5位或以上，建议密码长度设置一些，且以0-9a-zA-Z.@_-!等符号组合！</p>
                    <p id="password_tips"></p>
                </dd>
            </dl>
<!--             <dl class="row">
                <dt class="tit">
                    <label for="password">确认密码</label>
                </dt>
                <dd class="opt">
                    <input type="password" name="password2" value="" id="password2" autocomplete="off" class="input-txt">
                    <p class="notic"></p>
                    <p id="password2_tips"></p>
                </dd>
            </dl> -->
            <dl class="row">
                <dt class="tit">
                    <label for="pen_name">笔名</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="pen_name" :value="list.pen_name" :placeholder="list.pen_name" v-model="pen_name" id="pen_name" class="input-txt" autocomplete="off">
                    <p class="notic">发布文档后显示责任编辑的名字，禁止与用户名设置一致，以免存在安全隐患</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="true_name">真实姓名</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="true_name" :value="list.true_name" :placeholder="list.true_name" v-model="true_name" id="true_name" class="input-txt" >
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="mobile">手机号码</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="mobile"  :placeholder="list.mobile" v-model="mobile" id="mobile"  class="input-txt" autocomplete="off">
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="email">Email邮箱</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="email"  :placeholder="list.email" v-model="email" id="email" class="input-txt" autocomplete="off">
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="desc">工作内容</label>
                </dt>
                <dd class="opt">
                    <textarea rows="5" cols="60" id="desc" name="desc" :placeholder="list.desc"  v-model="desc" style="height:60px;">{{list.desc}}</textarea>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>

                        <div class="bot2">
                <input type="hidden" name="__token_admin_edit__" value="9c1837e6eae335ac14844f8153ab5984" />                <a href="JavaScript:;" @click.prevent="commit()" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
            </div>
        </div>
    </form>
</div>
<textarea name="admin_role_list" id="admin_role_list" class="none">[{"id":1,"name":"\u4f18\u5316\u63a8\u5e7f\u5458","pid":0,"remark":"","grade":0,"language":["cn"],"online_update":0,"switch_map":1,"only_oneself":1,"check_oneself":1,"cud":["add","edit","del"],"permission":{"rules":["1","3","4","8","9","10","14",2],"arctype":["1","2","3","4","5","6","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","8","32","9","30","31","11","12","13","23","20","24","25","21","26","22","27","28","29","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67"]},"built_in":1,"sort_order":100,"status":1,"admin_id":0,"add_time":1541207843,"update_time":0},{"id":2,"name":"\u5185\u5bb9\u7ba1\u7406\u5458","pid":0,"remark":"","grade":0,"language":["cn"],"online_update":0,"switch_map":1,"only_oneself":1,"check_oneself":1,"cud":["add","edit","del"],"permission":{"rules":["1","10","14",2],"arctype":["1","2","3","4","5","6","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","8","32","9","30","31","11","12","13","23","20","24","25","21","26","22","27","28","29","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67"]},"built_in":1,"sort_order":100,"status":1,"admin_id":0,"add_time":1541207846,"update_time":0}]</textarea>
<script type="text/javascript">
    $(function(){
        // 默认全部禁用复选框
        $('#postForm input[type="checkbox"]').attr("disabled","disabled");

        /*超级管理员默认全选复选框*/
        if (0 >= -1) {
            $('#postForm input[type="checkbox"]').attr('checked', 'checked');
            $('#postForm img.cboximg').attr('src', '/public/static/admin/images/ok.png');
            // $('#postForm input[name=only_oneself]').val(0);
            // $('#postForm input[name=only_oneself]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/del.png');
        }
        /*--end*/

        $('.arctype_bg').bind('click', function(){
            var acid = $(this).next().find('input').val(), input = 'arctype_child_' + acid;
            $('.arctype_child').hide();
            if( $(this).attr('class').indexOf('expandable') == -1 ){
                $(this).removeClass('collapsable').addClass('expandable');
            }else{
                $('.arctype_bg').removeClass('collapsable').addClass('expandable');
                $(this).removeClass('expandable').addClass('collapsable');
                $('#'+input).show();
            }
        });
        $('.arctype_cbox').bind('click', function(){
            var acid = $(this).val(), input = 'arctype_child_' + acid;
            var pid = $(this).data('pid');
            var tpid = $(this).data('tpid');
            if($(this).attr('checked')){
                if (0 < $('input[data-pid="'+pid+'"]:checked').length) {
                    $('.arctype_id_'+pid).attr('checked', 'checked');
                    $('.arctype_id_'+pid).parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                }
                if (0 < $('#arctype_child_'+tpid).find('input[type="checkbox"]:checked').length) {
                    $('.arctype_id_'+tpid).attr('checked', 'checked');
                    $('.arctype_id_'+tpid).parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                }
                $('#'+input).find('input[type="checkbox"]').attr('checked', 'checked');
                $('#'+input).find('input[type="checkbox"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
            }else{
                if (1 > $('input[data-pid="'+pid+'"]:checked').length) {
                    $('.arctype_id_'+pid).removeAttr('checked');
                    $('.arctype_id_'+pid).parent().find('img.cboximg').attr('src', '/public/static/admin/images/del.png');
                }
                if (1 > $('#arctype_child_'+tpid).find('input[type="checkbox"]:checked').length) {
                    $('.arctype_id_'+tpid).removeAttr('checked');
                    $('.arctype_id_'+tpid).parent().find('img.cboximg').attr('src', '/public/static/admin/images/del.png');
                }
                $('#'+input).find('input[type="checkbox"]').removeAttr('checked');
                $('#'+input).find('input[type="checkbox"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/del.png');
            }
        });
        $('#select_cud').bind('click', function(){
            if($(this).attr('checked')){
                $('#postForm input[name^="cud"]').attr('checked', 'checked');
                $('#postForm input[name^="cud"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
            }else{
                $('#postForm input[name^="cud"]').removeAttr('checked');
                $('#postForm input[name^="cud"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/del.png');
            }
        });

        $('#select_all_permission').bind('click', function(){
            if($(this).attr('checked')){
                $('#postForm input[name^="permission"]').attr('checked', 'checked');
                $('#postForm input[name^="permission"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
            }else{
                $('#postForm input[name^="permission"]').removeAttr('checked');
                $('#postForm input[name^="permission"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/del.png');
            }
        });
        $('#postForm input[name^="permission"],#postForm input[name^="cud"]').bind('click', function(){
            hasSelectAll();
        });

        hasSelectAll();
    });

    function hasSelectAll(){
        var c = true;
        $('#postForm input[name^="permission"]').each(function(idx, ele){
            if(! $(ele).attr('checked')){
                c = false;
                return;
            }
        });
        if(c){
            $('#select_all_permission').attr('checked', 'checked');
            $('#select_all_permission').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
        }else{
            $('#select_all_permission').removeAttr('checked');
            $('#select_all_permission').parent().find('img.cboximg').attr('src', '/public/static/admin/images/del.png');
        }

        var c = true;
        $('#postForm input[name^="cud"]').each(function(idx, ele){
            if(! $(ele).attr('checked')){
                c = false;
                return;
            }
        });
        if(c){
            $('#select_cud').attr('checked', 'checked');
            $('#select_cud').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
        }else{
            $('#select_cud').removeAttr('checked');
            $('#select_cud').parent().find('img.cboximg').attr('src', '/public/static/admin/images/del.png');
        }
    }

    function changeRole(value){
        if (-1 == value) {
            $('#postForm input[type="checkbox"]').attr("checked","checked").attr('disabled', 'disabled');
            $('#postForm img.cboximg').attr('src', '/public/static/admin/images/ok.png');
            // $('#postForm input[name=only_oneself]').val(0);
            // $('#postForm input[name=only_oneself]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/del.png');
            return;
        }
        
        $('#postForm input[name!="role_id"]').removeAttr('checked').removeAttr('disabled');
        $('#postForm img.cboximg').attr('src', '/public/static/admin/images/del.png');

        // if(value == "0"){
        //     $('#postForm input[name!="role_id"]').attr('checked', 'checked');
        //     $('#postForm input[name="online_update"]').removeAttr('checked');
        //     $('#postForm input[name="switch_map"]').removeAttr('checked');
        //     $('#postForm input[name="only_oneself"]').removeAttr('checked');
        //     return ;
        // }
        var admin_role_list = JSON.parse($('#admin_role_list').val());
        for(var i in admin_role_list){
            var item = admin_role_list[i];
            if(item.id == value){
                if(item.language){
                    item.language.map(function(row){
                        $('#postForm input[name^="language"][value="'+row+'"]').attr('checked', 'checked');
                        $('#postForm input[name^="language"][value="'+row+'"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                    });
                }

                if(item.online_update){
                    $('#postForm input[name="online_update"]').attr('checked', 'checked');
                    $('#postForm input[name="online_update"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                };
                if(item.switch_map){
                    $('#postForm input[name="switch_map"]').attr('checked', 'checked');
                    $('#postForm input[name="switch_map"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                };
                // if(item.editor_visual){
                //     $('#postForm input[name="editor_visual"]').attr('checked', 'checked');
                //     $('#postForm input[name="editor_visual"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                // };
                if(item.only_oneself){
                    $('#postForm input[name="only_oneself"]').attr('checked', 'checked');
                    $('#postForm input[name="only_oneself"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                };
                if(item.check_oneself){
                    $('#postForm input[name="check_oneself"]').attr('checked', 'checked');
                    $('#postForm input[name="check_oneself"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                };
                if(item.cud){
                    item.cud.map(function(row){
                        $('#postForm input[name^="cud"][value="'+row+'"]').attr('checked', 'checked');
                        $('#postForm input[name^="cud"][value="'+row+'"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                    });
                }
                if(item.permission){
                    for(var p in item.permission){
                        if(p == 'plugins'){
                            if(item.permission[p]){
                                for(var pluginId in item.permission[p]){
                                    $('#postForm input[name="permission['+p+']['+pluginId+'][id]"][value="'+pluginId+'"]').attr('checked', 'checked');
                                    $('#postForm input[name="permission['+p+']['+pluginId+'][code]"][value="'+pluginId+'"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                                    if(item.permission[p][pluginId].child){
                                        item.permission[p][pluginId].child.map(function(row){
                                            $('#postForm input[name="permission['+p+']['+pluginId+'][child][]"][value="'+row+'"]').attr('checked', 'checked');
                                            $('#postForm input[name="permission['+p+']['+pluginId+'][child][]"][value="'+row+'"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                                        });
                                    }
                                }
                            }
                        } else if (p == 'arctype') {
                            item.permission[p].map(function(row){
                                $('#postForm .arctype_id_'+row).attr('checked', 'checked');
                                $('#postForm .arctype_id_'+row).parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                            });
                        }else{
                            item.permission[p].map(function(row){
                                $('#postForm input[name="permission['+p+'][]"][value="'+row+'"]').attr('checked', 'checked');
                                $('#postForm input[name="permission['+p+'][]"][value="'+row+'"]').parent().find('img.cboximg').attr('src', '/public/static/admin/images/ok.png');
                            });
                        }
                    }
                }
                
                hasSelectAll();
                $('#postForm input[type="checkbox"]').attr('disabled', 'disabled');
                break;
            }
        }
    }

    function addRole(obj)
    {
        var url = $(obj).data('url');
        // iframe窗
        layer.open({
            type: 2,
            title: '自定义用户组',
            fixed: true, //不固定
            shadeClose: false,
            shade: layer_shade,
            maxmin: false, //开启最大化最小化按钮
            area: ['90%', '90%'],
            content: url
        });
    }

    function custom_role(str, new_role_id, auth_role_list)
    {
        $('#custom_role').before(str);
        $('#admin_role_list').val(auth_role_list);
        changeRole(new_role_id);
    }

    function head_pic_call_back(fileurl_tmp)
    {
      $("#head_pic").val(fileurl_tmp);
      $("#img_head_pic").attr('src', fileurl_tmp);
    }

    $('#password').keyup(function(){
        var password = $(this).val();
        $.ajax({
            url: "/login.php?m=admin&c=Admin&a=ajax_checkPasswordLevel&lang=cn",
            type: "POST",
            dataType: "JSON",
            data: {password:password, _ajax:1},
            success: function(res){
                $('#password_tips').removeAttr('class');
                if (1 == res.code) {
                    $('#password_tips').addClass('rank r'+res.data.pwdLevel);
                }
            }
        });
    });
/*
    $('#password2').keyup(function(){
        var password = $('#password').val();
        var password2 = $('#password2').val();
        $('#password2_tips').hide();
        if (password != '' || password2 != '') {
            if (password != password2) {
                $('#password2_tips').html('<font color="red">两次密码输入不一致！</font>').show();
            } else {
                $('#password2_tips').html('<font color="green">校验通过！</font>').show();
            }
        }
    });
*/
    var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
    // 判断输入框是否为空
    function adsubmit(){
        if ($('input[name=user_name]').length > 0) {
            var user_name = $('input[name=user_name]').val();
            if($.trim(user_name) == '') {
                showErrorMsg('用户名不能为空！');
                $('input[name=user_name]').focus();
                return false;
            } 
        }
        var password = $.trim($('#password').val());
        if(0 < password.length && password.length < 5) {
            showErrorMsg('用户密码至少5位或以上！');
            $('input[name=password]').focus();
            return false;
        } 
/*        
        var password = $('#password').val();
        var password2 = $('#password2').val();
        if (password != '' || password2 != '') {
            if (password != password2) {
                showErrorMsg('两次密码输入不一致！');
                $('input[name=password]').focus();
                return false;
            }
        }
*/
        layer_loading('正在处理');
        $.ajax({
            type : 'post',
            url : "/login.php?m=admin&c=Admin&a=admin_edit&_ajax=1&lang=cn",
            data : $('#postForm').serialize(),
            dataType : 'json',
            success : function(res){
                layer.closeAll();
                if(res.code == 1){
                    var _parent = parent;
                    _parent.layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
                        _parent.window.location.reload();
                    });
                }else{
                    showErrorMsg(res.msg);
                    $('input[name='+res.data.input_name+']').focus();
                }
            },
            error: function(e){
                layer.closeAll();
                layer.alert(e.responseText, {icon: 5, title:false});
            }
        });
    }

    /**
     * 绑定微信应用
     * @return {[type]} [description]
     */
    var notifyPolling = null;
    function wechat_bind(obj)
    {
        var logintype = $(obj).attr('data-logintype');
        if ('WechatLogin' == logintype) {
            var gourl = window.location.href;
            var url = "http://111.173.104.169:83/login.php?m=admin&c=Admin&a=wechat_bind&admin_id=1&lang=cn";
            url += "&gourl="+encodeURIComponent(gourl);
            var iframes = layer.open({
                type: 2,
                title: '微信扫码绑定',
                fixed: true, //不固定
                shadeClose: false,
                shade: layer_shade,
                // maxmin: true, //开启最大化最小化按钮
                area: ['500px', '460px'],
                content: url
            });
        } else if ('EyouGzhLogin' == logintype) {
            layer_loading('正在加载');
            var admin_id = 1;
            $.ajax({
                type: 'POST',
                url: "/login.php?m=admin&c=Admin&a=mp_getqrcode&lang=cn",
                data: {op:'bind', admin_id:admin_id, _ajax:1},
                dataType: "JSON",
                success: function(res){
                    layer.closeAll();
                    if (1 == res.code) {
                        var html_content = '<img src="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='+ res.data.ticket +'" style="width: 250px; height: 250px;"><p style="color: red;padding: 8px 0;font-size: 15px;text-align: center;">打开微信扫一扫</p> <script type="text/javascript"> getNotify("'+admin_id+'","'+res.data.uniqid_scene+'"); <\/script>';
                        layer.open({
                            type: 1,
                            title:'微信扫码绑定',
                            id: 'layer_official_account',
                            shadeClose: false,
                            content: html_content,
                            end: function() {
                                clearNotify();
                            }
                        });
                    }else{
                        showErrorAlert(res.msg);
                    }
                },
                error: function(e){
                    layer.closeAll();
                    showErrorAlert(e.responseText);
                }
            });
        }
    }

    /**
     * 轮询是否绑定官方公众号
     * @return {[type]} [description]
     */
    function getNotify(admin_id, uniqid_scene){
        notifyPolling = setTimeout(function(){
            $.ajax({
                type: 'POST',
                url: "/login.php?m=admin&c=Admin&a=mp_bingwxgzhopenid&lang=cn",
                data: {op:'bind', admin_id:admin_id, uniqid_scene:uniqid_scene, _ajax:1},
                dataType: "JSON",
                success: function(res){
                    if (1 == res.data.code) {
                        layer.closeAll();
                        clearNotify();
                        $('#span_wechat_nickname').html('已绑定公众号');
                        $('#wechat_bind').hide();
                        $('#wechat_unbind').show();
                        layer.msg('绑定成功', {shade: layer_shade, time: 1000});
                    } else if (0 == res.code) {
                        layer.closeAll();
                        clearNotify();
                        layer.alert(res.msg, {icon: 5, title:false, closeBtn:false}, function(){
                            window.location.reload();
                        });
                    } else if (2 == res.data.code) {
                        getNotify(admin_id, uniqid_scene);
                    }
                },
                error: function(e){
                    layer.closeAll();
                    clearNotify();
                    layer.alert('扫码检测异常，重新尝试！', {icon: 5, title:false, closeBtn:false}, function(){
                        window.location.reload();
                    });
                }
            });
        }, 1800);
    }

    function clearNotify(){
        if(notifyPolling > 0){
            clearTimeout(notifyPolling);
            notifyPolling = null;
        }
    }

    /**
     * 解除绑定微信应用
     * @return {[type]} [description]
     */
    function wechat_unbind(obj)
    {
        var logintype = $(obj).attr('data-logintype');
        if ('WechatLogin' == logintype) {
            var admin_id = 1;
            layer_loading('正在处理');
            $.ajax({
                type : 'post',
                url : "/login.php?m=admin&c=Admin&a=wechat_unbind_handle&lang=cn",
                data : {admin_id:admin_id, _ajax:1},
                dataType : 'json',
                success : function(res){
                    layer.closeAll();
                    if(res.code == 1){
                        $('#span_wechat_nickname').html('未绑定');
                        $('#wechat_bind').show();
                        $('#wechat_unbind').hide();
                        layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
                            // window.location.reload();
                        });
                    }else{
                        showErrorAlert(res.msg);
                    }
                },
                error: function(e){
                    layer.closeAll();
                    showErrorAlert(e.responseText);
                }
            });
        } else if ('EyouGzhLogin' == logintype) {
            var admin_id = 1;
            layer_loading('正在处理');
            $.ajax({
                type: 'POST',
                url: '/login.php?m=admin&c=Admin&a=mp_unbindwx&lang=cn',
                data: {admin_id:admin_id, _ajax:1},
                dataType: "JSON",
                success: function(res){
                    layer.closeAll();
                    if (1 == res.code){
                        $('#span_wechat_nickname').html('未绑定');
                        $('#wechat_bind').show();
                        $('#wechat_unbind').hide();
                        layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
                            // window.location.reload();
                        });
                    }else{
                        showErrorAlert(res.msg);
                    }
                },
                error: function(e){
                    layer.closeAll();
                    showErrorAlert(e.responseText);
                }
            });
        }
    }
</script>

<div id="goTop">
    <a href="JavaScript:void(0);" id="btntop">
        <i class="fa fa-angle-up"></i>
    </a>
    <a href="JavaScript:void(0);" id="btnbottom">
        <i class="fa fa-angle-down"></i>
    </a>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        $('#think_page_trace_open').css('z-index', 99999);
    });
</script>

<script>
    var vm = new Vue({
		el: '#app',
		data: {
			admin_id:0,
		    list:[],
		    user_name:"",
			password:"",
			pen_name:"",
			true_name:"",
			mobile:"",
			email:"",
			desc:""
		},
		created(){
		    let url=window.location.search;
		    let urlParams = new URLSearchParams(url);
		    this.admin_id=urlParams.get("id");
		  //  this.searchtext=urlParams.get("searchtext");
		    this.details();
		},
		mounted(){
		    
		},
		methods: {
		    details: function() {
			    this.$http.post('api/getadmininfo.php',{
			        admin_id:this.admin_id
			        
			    },{emulateJSON: true}).then(function(res){
			        console.log(res.body);
			        this.list=res.body;
			    },function(){
			        console.log("request fail");
			    })
			},
			commit:function(){


			    this.$http.post('api/adminedit.php',{
			        admin_id:   this.admin_id,
			        user_name:  this.user_name,
			        password:   this.password,
			        pen_name:   this.pen_name,
			        true_name:  this.true_name,
			        mobile:     this.mobile,
			        email:      this.email,
			        desc:       this.desc
			    },{emulateJSON: true}).then(function(res){
			        let code=res.body.code;
			        if(code==200){
			            alert("success");
			            
			            setTimeout(function(){
			                window.location.href="/admin.html";
			            },2000)
			        }
			    },function(){
			        console.log("request fail");
			    })
			}
		}
	})
</script>



</body>
</html>